package com.joinway.framework.support.logging.utils;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;

import com.joinway.framework.support.logging.constant.LoggingConstants;

public class LogMethodNameConverter extends ClassicConverter{

	@Override
	public String convert(ILoggingEvent event) {
		String prefix = MDC.get(LoggingConstants.LOGGER_KEY);
		return StringUtils.isBlank(prefix) ? event.getLoggerName() : prefix;
	}

}
